"""处理其他公共方法"""
import os


class ProcessingOthers:
    def __init__(self):
        pass

    def get_newest_file(self, file_path_name):
        """获取最新文件"""
        all_file = []

        file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), file_path_name)
        for maindir, subdir, file_list in os.walk(file_path):
            pass

        if len(file_list)!=0:
            for filename in file_list:
                all_file.append(os.path.join(file_path, filename))

        if len(all_file)!=0:
            file_name = all_file[-1]
            return True, file_name

        else:
            return False, "获取最新文件失败"
